#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
int main(int argc, const char *argv[])
{
	int fd[2];
	pipe(fd);

	pid_t pid=fork();
	if(pid==0)
	{
		char writebuf[32];
		while(1)
		{
			scanf("%s",writebuf);
			getchar();
			write(fd[1],writebuf,31);

		}
	}
	else if(pid>0)
	{
		char getbuf[32];
		while(1)
		{
			int len=read(fd[0],getbuf,31);
			if(len>0)
			{
				printf("%s",getbuf);
				printf("\n");
				memset(getbuf,0,sizeof(getbuf));
			}

		}
	}

	sleep(1);

	return 0;
}
